from public.action import *
from public.business import *
from public.testData import *
from public.tools import *
import time

testCase = "DBshop007_销售管理_发货单查看"

#打开网页,登录登台管理
firefox=openBrowser(urlAdmin)
DBshopLoginAdmin(firefox)

#调用二级函数点击销售管理-发货单界面
DBshopEnterMenu2(firefox,'销售管理','发货单')

#获取已存在的订单编号
rootPath=get_pro_rootpath() #获取项目的绝对路径
filePath=rootPath+r'\public\order1.txt' #拼接文件路径
orderNo=readFile(filePath) #读取文件中的订单编号
print(orderNo)

firefox.find_element_by_xpath('//td[text()="%s"]/following-sibling::td[5]/a'%orderNo).click()
time.sleep(4)

#获取当前页面订单号状态
s=firefox.find_element_by_xpath("//body").text
l="订单号"+orderNo+"  "
r="\)"
order_State=reGetString(s,l,r)
print(order_State) #order_State 是实际值
yuqi="已发货"  #这是预期值
#检查点
if yuqi==order_State:
    writeLog("%s 测试通过" % testCase)
else:
    writeLog("%s 测试不通过" % testCase)
    getPhoto(firefox)
firefox.quit()

